package com.coscon.service.patternCommon.impl.systemos;

import com.coscon.model.IrcaCmd;
import com.coscon.service.patternCommon.ICommand;

import javax.websocket.Session;
import java.awt.*;
import java.awt.event.KeyEvent;

/**
 * 系统控制：切换窗口改变选择
 */
public class SystemOsSelectWinChangeCmdImpl implements ICommand {

    private Robot rb;

    public SystemOsSelectWinChangeCmdImpl(Robot rb){
        this.rb = rb;
    }


    @Override
    public Boolean executeByMac(IrcaCmd cmd, Session session) {
        rb.keyPress(KeyEvent.VK_TAB);
        rb.keyRelease(KeyEvent.VK_TAB);
        return true;
    }

    @Override
    public Boolean executeByWin(IrcaCmd cmd, Session session) {
        rb.keyPress(KeyEvent.VK_TAB);
        rb.keyRelease(KeyEvent.VK_TAB);
        return true;
    }

    @Override
    public Boolean executeByLinux(IrcaCmd cmd, Session session) {
        return true;
    }

}
